package com.sop.dao.impl;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.sop.dao.OrganizationalDao;
import com.sop.model.OrganizationalInfo;
import com.sop.model.vo.OrganizationalInfoVo;

import common.base.dao.IBaseDaoImpl;
import common.tools.StringTool;

@Repository("organizationalDao")
public class OrganizationalDaoImpl extends IBaseDaoImpl<OrganizationalInfo,OrganizationalInfoVo> implements OrganizationalDao{

	@Override
	public Criteria getSearchCriteria(Session session,OrganizationalInfoVo searchVo) {
		 Criteria c = session.createCriteria(OrganizationalInfo.class);  
         
	        if(searchVo.getOrganizationalInfo()!=null){
	        //检索条件  
	            String name =  searchVo.getOrganizationalInfo().getName();  
	            if (StringTool.isStringAvaliable(name)) {  
	                c.add(Restrictions.ilike("name", "%" + name + "%"));  
	            }  
	        }   
	        return c;
	}

}
